
#include <jni.h>

#ifdef __cplusplus
#define JNI_API extern "C"
#else
#define JNI_API
#endif

JNI_API {

JNIEXPORT jlong JNICALL
Java_com_tencent_platformadapter_TencentRTCJni_getJObjectAddress(JNIEnv *env, jclass clazz, jobject object) {
    return reinterpret_cast<jlong>(env->NewGlobalRef(object));
}

JNIEXPORT jstring JNICALL
Java_com_tencent_platformadapter_TencentRTCJni_getStringToC(JNIEnv *env, jclass clazz) {
    const char * str = "from c++";
    return env->NewStringUTF(str);
}


JNIEXPORT void JNICALL
Java_com_tencent_platformadapter_TencentRTCJni_freeJobjectAddress(JNIEnv *env, jclass clazz, jlong ptr) {
    auto global_ref = reinterpret_cast<jobject>(ptr);
    env->DeleteGlobalRef(global_ref);
}

}